Update Quickstart for Rust to v5#242
Open
Aaron LaBeau (biozal) wants to merge 14 commits intomainfrom
Open
Conversation
…ste in the yml file for each platform
Contributor
There was a problem hiding this comment.
Pull request overview
Updates the rust-tui Ditto quickstart from Ditto SDK v4 to v5, adjusting initialization/auth flows and migrating sync/store API calls while keeping the TUI tasks app behavior intact.
Changes:
- Bumps Rust quickstart to
dittolive-dittov5 and updates Ditto sync/store APIs (subscriptions, observers, execute, sync start/stop). - Refactors the TUI create/edit prompt rendering to be mode-driven.
- Updates CI toolchain pinning and revises README instructions for setup.
Reviewed changes
Copilot reviewed 9 out of 10 changed files in this pull request and generated 7 comments.
Show a summary per file
| File | Description |
|---|---|
| rust-tui/src/tui/todolist.rs | Migrates Ditto v4 APIs to v5 and updates create/edit prompt rendering. |
| rust-tui/src/tui/mod.rs | Minor import reorder while keeping TUI task orchestration unchanged. |
| rust-tui/src/term.rs | Minor re-export ordering update for ratatui terminal backend/types. |
| rust-tui/src/input.rs | Removes unused input helper module. |
| rust-tui/src/bin/main.rs | Reworks Ditto initialization for v5 (DittoConfig, auth expiration handler, sync start/stop). |
| rust-tui/src/bin/integration_test.rs | Migrates integration test Ditto initialization to v5 and updates sync control. |
| rust-tui/README.md | Updates quickstart setup instructions and environment variable guidance. |
| rust-tui/Cargo.toml | Bumps edition to 2024 and pins dittolive-ditto to v5.0.0; removes unused dependency. |
| rust-tui/Cargo.lock | Lockfile updates for Ditto v5 and transitive dependency changes. |
| .github/workflows/rust-tui-ci.yml | Pins Rust toolchain in CI and keeps clippy/fmt/test/integration-test steps. |
Comments suppressed due to low confidence (1)
rust-tui/README.md:13
- The README instructs copying
.env.sample, but the command shown iscp .sample.env .env. In this repo the file is named.env.sampleat the repo root, so the command should match or new users will fail setup.
From the repo root, copy the `.env.sample` file to `.env`, and fill in the fields with your DatabaseID, Online Playground Token, and Auth URL:
cp .sample.env .env
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This PR is for updating the Rust-Tui example QuickStart from v4 to v5.
Summary
dittolive-ditto = "4.13.1"→"=5.0.0"(pinned)Ditto::builder().with_root().with_identity()is gone — replaced byDittoConfig::new(database_id, DittoConfigConnect::Server { url })+Ditto::open_sync(config)TokenHandlerthat implementsDittoAuthExpirationHandlerand is registered viaditto.auth()?.set_expiration_handler(...). Replaces theold "pass token to OnlinePlayground" flow.
ditto.start_sync()/ditto.is_sync_active()toditto.sync().start()/ditto.sync().is_active()etc.*_v2suffixes dropped:register_subscription_v2,register_observer_v2,execute_v2are now justregister_subscription,register_observer,execute.disable_sync_with_v3()andALTER SYSTEM SET DQL_STRICT_MODE = falseare no longer needed in v5.hashbrowndependency, deleted the emptysrc/input.rs, removed two unused fields fromTodolistthat were superseded by the existingTodoModeenum, fixed the edit dialog showing the wrong title, README rewording.API migration cheat sheet
Ditto::builder().with_root().with_identity(OnlinePlayground::new(...))?.build()?OnlinePlayground::new(root, app_id, token, false, Some(auth_url))TokenHandler { token }registered viaditto.auth()?.set_expiration_handler(...)app_id: AppId(parsed)database_id: Stringditto.start_sync()ditto.sync().start()?ditto.stop_sync()ditto.sync().stop()ditto.is_sync_active()ditto.sync().is_active()ditto.disable_sync_with_v3()ALTER SYSTEM SET DQL_STRICT_MODE = falseditto.sync().register_subscription_v2(...)ditto.sync().register_subscription(...)ditto.store().register_observer_v2(...)ditto.store().register_observer(...)ditto.store().execute_v2((sql, args))ditto.store().execute((sql, args))Environment variable changes
DITTO_APP_IDDITTO_PLAYGROUND_TOKENDITTO_AUTH_URLDITTO_WEBSOCKET_URLDITTO_CLIENT_NAMEDITTO_P2P_ENABLEDFiles changed
rust-tui/Cargo.toml=5.0.0, edition 2024, drophashbrownrust-tui/Cargo.lockrust-tui/src/bin/main.rsTokenHandler, sync API migrationrust-tui/src/bin/integration_test.rsrust-tui/src/tui/todolist.rscreate_task_title/edit_taskfields, fixed edit-dialog titlerust-tui/src/tui/mod.rsrust-tui/src/term.rsrust-tui/src/input.rsrust-tui/README.mdDITTO_WEBSOCKET_URLfrom required setup.github/workflows/rust-tui-ci.yml1.91.1on all four jobsNotable behavior changes
render_todo_prompt(formerlyrender_new_todo_prompt) now shows" New Todo "vs" Edit Todo "based onTodoMode. Previously the edit dialog incorrectly displayed"New Todo".
Todolist::create_task_title: Option<String>andTodolist::edit_task: Option<(String, String)>were never read after theTodoModerefactor — nowremoved.
ditto.start_sync()(which returned()and was discarded with_ =) is replaced byditto.sync().start()?, so a failure to start sync nowsurfaces as an error instead of being silently swallowed. Same for
disable_sync_with_v3()/ strict-mode disable, which are simply gone.Test plan
cargo buildfromrust-tui/succeedscargo clippy --all-targetsis cleancargo fmt --checkis cleancargo runlaunches the TUI and connects to Big Peer (Database ID + Playground Token + Auth URL set in.env)stoggles sync; status indicator flips green ↔ red